using System.Collections.Generic;
using System.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HengTong.Model.Db.Hr;


namespace HengTong.ViewModel.Person.SysPersonSocialSecuritySchemeVms
{
    public partial class SysPersonSocialSecuritySchemeListVm : BaseListVm<SysPersonSocialSecuritySchemeView, SysPersonSocialSecuritySchemeSearcher>
    {

        protected override IEnumerable<IGridColumn<SysPersonSocialSecuritySchemeView>> InitGridHeader()
        {
            return new List<GridColumn<SysPersonSocialSecuritySchemeView>>{
                this.MakeGridHeader(x => x.SchemeName),
                this.MakeGridHeader(x => x.SchemeCode),
                this.MakeGridHeader(x => x.PaymentArea),
                this.MakeGridHeader(x => x.IsEnabled),
                this.MakeGridHeader(x => x.SocialSecurityBase),
                this.MakeGridHeader(x => x.PensionPersonal),
                this.MakeGridHeader(x => x.PensionCompany),
                this.MakeGridHeader(x => x.MedicalPersonal),
                this.MakeGridHeader(x => x.MedicalCompany),
                this.MakeGridHeader(x => x.UnemploymentPersonal),
                this.MakeGridHeader(x => x.UnemploymentCompany),
                this.MakeGridHeader(x => x.InjuryCompany),
                this.MakeGridHeader(x => x.MaternityCompany),
                this.MakeGridHeader(x => x.HousingFundBase),
                this.MakeGridHeader(x => x.HousingFundPersonal),
                this.MakeGridHeader(x => x.HousingFundCompany),
                this.MakeGridHeader(x => x.PersonalTotal),
                this.MakeGridHeader(x => x.CompanyTotal),
                this.MakeGridHeader(x => x.Remark),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<SysPersonSocialSecuritySchemeView> GetSearchQuery()
        {
            var query = DC.Set<SysPersonSocialSecurityScheme>()
                .CheckContain(Searcher.SchemeName, x=>x.SchemeName)
                .CheckContain(Searcher.SchemeCode, x=>x.SchemeCode)
                .CheckContain(Searcher.PaymentArea, x=>x.PaymentArea)
                .CheckEqual(Searcher.IsEnabled, x=>x.IsEnabled)
                .CheckEqual(Searcher.SocialSecurityBase, x=>x.SocialSecurityBase)
                .CheckEqual(Searcher.PensionPersonal, x=>x.PensionPersonal)
                .CheckEqual(Searcher.PensionCompany, x=>x.PensionCompany)
                .CheckEqual(Searcher.MedicalPersonal, x=>x.MedicalPersonal)
                .CheckEqual(Searcher.MedicalCompany, x=>x.MedicalCompany)
                .CheckEqual(Searcher.UnemploymentPersonal, x=>x.UnemploymentPersonal)
                .CheckEqual(Searcher.UnemploymentCompany, x=>x.UnemploymentCompany)
                .CheckEqual(Searcher.InjuryCompany, x=>x.InjuryCompany)
                .CheckEqual(Searcher.MaternityCompany, x=>x.MaternityCompany)
                .CheckEqual(Searcher.HousingFundBase, x=>x.HousingFundBase)
                .CheckEqual(Searcher.HousingFundPersonal, x=>x.HousingFundPersonal)
                .CheckEqual(Searcher.HousingFundCompany, x=>x.HousingFundCompany)
                .CheckEqual(Searcher.PersonalTotal, x=>x.PersonalTotal)
                .CheckEqual(Searcher.CompanyTotal, x=>x.CompanyTotal)
                .CheckContain(Searcher.Remark, x=>x.Remark)
                .Select(x => new SysPersonSocialSecuritySchemeView
                {
				    ID = x.ID,
                    SchemeName = x.SchemeName,
                    SchemeCode = x.SchemeCode,
                    PaymentArea = x.PaymentArea,
                    IsEnabled = x.IsEnabled,
                    SocialSecurityBase = x.SocialSecurityBase,
                    PensionPersonal = x.PensionPersonal,
                    PensionCompany = x.PensionCompany,
                    MedicalPersonal = x.MedicalPersonal,
                    MedicalCompany = x.MedicalCompany,
                    UnemploymentPersonal = x.UnemploymentPersonal,
                    UnemploymentCompany = x.UnemploymentCompany,
                    InjuryCompany = x.InjuryCompany,
                    MaternityCompany = x.MaternityCompany,
                    HousingFundBase = x.HousingFundBase,
                    HousingFundPersonal = x.HousingFundPersonal,
                    HousingFundCompany = x.HousingFundCompany,
                    PersonalTotal = x.PersonalTotal,
                    CompanyTotal = x.CompanyTotal,
                    Remark = x.Remark,
                })
                .OrderBy(x => x.ID);
            return query;
        }
    }

    public class SysPersonSocialSecuritySchemeView : SysPersonSocialSecurityScheme{

    }
}
